﻿namespace BSU.Math.Geometry
{
    public static class Angle
    {
        public static double DegreesToRadians(double degrees)
        {
            return (System.Math.PI / 180) * degrees;
        }

        public static double RadiansToDegrees(double radians)
        {
            return 180 * radians / System.Math.PI;
        }

        public static int As180(int angle)
        {
            angle = angle % 360;

            angle = (angle < -180) ?
                                       180 - System.Math.Abs(angle % 180)
                        : (angle > 180) ?
                                            System.Math.Abs(angle % 180) - 180
                              : angle;
            return angle;
        }
    }
}